﻿using Lidgren.Network;

namespace Network.Messages.FileTranser
{
    public class ResponseBeginCopyFileMessage : NovaMessage
    {
        /// <summary>
        /// 文件路径
        /// </summary>
        public string FilePath;

        /// <summary>
        /// 标识是否为压缩包
        /// </summary>
        public bool FlagZip;

        /// <summary>
        /// 用于唯一标识的标签
        /// </summary>
        public uint Number;

        /// <summary>
        /// 文件长度
        /// </summary>
        public ulong Length;

        public ResponseBeginCopyFileMessage() :
            base((ushort) CustomMessageType.ResponseBeginCopyFile)
        {
        }

        public override void WritePayload(NetOutgoingMessage message)
        {
            base.WritePayload(message);
            message.Write(FlagZip);
            message.Write(FilePath);
            message.Write(Number);
            message.Write(Length);
        }

        public override void ReadPayload(NetIncomingMessage message)
        {
            base.ReadPayload(message);
            FlagZip = message.ReadBoolean();
            FilePath = message.ReadString();
            Number = message.ReadUInt32();
            Length = message.ReadUInt64();
        }
    }
}